import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lily
 * Date: 2024-11-08
 * Time: 11:15
 */
public class test_2 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            String[] s = new String[n];
            for (int i = 0; i < n; i++) {
                s[i] = in.next();
            }
            boolean[] visited = new boolean[n];
            int ret = 0;
            for (int i = 0; i < n; i++) {
                if (!visited[i]) {
                    visited[i] = true;
                    for (int j = i + 1; j < n; j++) {
                        if (isPrime(s[i], s[j])) {
                            visited[j] = true;
                        }
                    }
                    ret++;
                }
            }
            System.out.println(ret);
        }
    }

    //判断是否同一类字符
    public static boolean isPrime(String s1, String s2) {
        int[] arr = new int[128];
        for (char c : s1.toCharArray()) {
            arr[c]++;
        }
        for (char c : s2.toCharArray()) {
            arr[c]--;
        }
        for (int i : arr) {
            if (i != 0) {
                return false;
            }
        }
        return true;
    }
}
